{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "IPyWidgets access static resources from the <pythonEnv>/share/jupyter/nbextensions/<widget> folder.\n",
    "The base url stored in `document.body['data-base-url]` points to the `<pythonEnv>/share/jupyter` directory.\n",
    "Thus any request for a static resource relative to that directory would work.\n",
    "E.g. <base-url>/nbextensions/<widget>/<file> will work.\n",
    "\n",
    "This test ensures such requests work, this is crucial for widgets to work (e.g. ipyleaflet with loads png files, vega which loads a wasm file, etc)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%html\n",
    "<div id='fetchOutputWidgetLeafletJsMap'>Hello</div>\n",
    "<div id='fetchOutputWidgetThreeJS'>Hello</div>\n",
    "<div id='fetchOutputWidgetSheetLicense'>Hello</div>\n",
    "<script type=\"application/javascript\">\n",
    "var url = document.body.getAttribute('data-base-url')\n",
    "fetch(url + \"nbextensions/jupyter-leaflet/index.js.map\").then(result => {\n",
    "\tconst ele = document.getElementById('fetchOutputWidgetLeafletJsMap');\n",
    "\tele.innerHTML = result.ok;\n",
    "});\n",
    "fetch(url + \"nbextensions/jupyter-threejs/index.js\").then(result => {\n",
    "\tconst ele = document.getElementById('fetchOutputWidgetThreeJS');\n",
    "\tele.innerHTML = result.ok;\n",
    "});\n",
    "fetch(url + \"nbextensions/ipysheet/index.js.LICENSE.txt\").then(result => {\n",
    "\tconst ele = document.getElementById('fetchOutputWidgetSheetLicense');\n",
    "\tele.innerHTML = result.ok;\n",
    "});\n",
    "</script>"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
